1. Field of the Invention
The present invention relates to an image compressor for generating compressed data after adjusting a bit length of a predicted difference for one pixel to a fixed bit length and to an image compression program.
The present invention also relates to an image decompressor for decompressing the compressed data and an image decompression program.
The present invention further relates to an electronic camera including the image compressor described above.
2. Description of the Related Art
Background Technique of an Electronic Camera
An electronic camera for storing raw data, which is obtained by continuous shooting, in a buffer memory without compression is known as a conventional electronic camera. The buffer memory eliminates the necessity of conducting image processing or record processing in real time, enabling the reduction of time between continuous shots of the electronic camera.
However, when the buffer memory is full of the raw data during such continuous shooting, the operation of continuous shooting becomes remarkably slow. As a result, the number of frames, which can be taken by continuous shots at short intervals (hereinafter, referred to as “the number of frames taken by high-speed continuous shooting”, has its limit.
In order to increase the number of frames taken by high-speed continuous shooting, it is normally necessary to increase the number of frames of raw data storable in the buffer memory.
Background Technique Related to Image Compression and Decompression
As a general data compression technique for raw data, a technique of performing variable length encoding on a predicted difference of raw data is known (the paragraph [0003] of Japanese Unexamined Patent Application Publication No. 2003-224868 and the like).
An electronic camera for recording uncompressed raw data in a buffer memory is known as a conventional electronic camera. The amount of uncompressed raw data is always constant. As a result, the above-described number of frames taken by high-speed continuous shooting becomes correspondingly always constant.
However, since the uncompressed raw data is quantized to have multiple gradation steps (for example, 12-bit quantization), the amount of data for each frame is large.
Accordingly, it is difficult to increase the number of frames taken by high-speed continuous shooting only if the uncompressed raw data is temporarily stored in the buffer memory.
In order to solve such a problem, a method of storing raw data in a buffer memory after image compression is conceived. For such image compression of the raw data, a conventional compression technique based on the variable length encoding described above can be used.
However, according to the variable length encoding, the amount of data after compression is not necessarily constant. In particular, when the assignment of variable length codes is not appropriate for the raw data, the amount of data after compression becomes unexpectedly large in some cases. In such a case, high-speed continuous shooting is interrupted at the early point of time. As a result, a disadvantage that a user misses the right moment to release the shutter, which is precious for the user, may arise.
In this manner, it was impossible to certainly ensure the minimum number of frames taken by high-speed continuous shooting if the raw data is variable-length encoded.
Consequently, the inventor of the invention studied a fixed bit length-based compression technique for fixing a bit length for each pixel.
In fixed bit length-based encoding, however, it is difficult to sufficiently increase the compression efficiency because a bit length for each pixel is fixed. If the compression efficiency is forced to be increased, there arises a fundamental problem that the degradation in image quality is increased along with the compression.